//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package itheima;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;

public class ArrayListDemo {
    public ArrayListDemo() {
    }

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList();
        list.add("zhangsan");
        list.add(0, "lisi");
        String s = (String)list.get(1);
        System.out.println(s);
        list.set(0, "wangwu");
        list.remove(1);
        list.add("zhangsan");
        list.add("lisi");
        list.add("wangwu");
        list.add("zhaoliu");
        list.add("zhangsan");
        list.add("zhangsan");
        System.out.println(list);
        System.out.println("----------集合的遍历方式1----------");

        String next;
        for(int i = 0; i < list.size(); ++i) {
            next = (String)list.get(i);
            System.out.println(next);
        }

        System.out.println("----------集合的遍历方式2----------");
        Iterator iterator = list.iterator();

        while(iterator.hasNext()) {
            next = (String)iterator.next();
            System.out.println(next);
        }

        System.out.println("----------集合的遍历方式3----------");
        iterator = list.iterator();

        while(iterator.hasNext()) {
            next = (String)iterator.next();
            System.out.println(next);
        }

        System.out.println("----------集合的遍历方式4----------");
        PrintStream var10001 = System.out;
        Objects.requireNonNull(var10001);
        list.forEach(var10001::println);
    }
}






